package com.example.demo.vo.board

import com.example.demo.dbmodels.TShiftType
import java.time.LocalDateTime

class ShiftTypeVo {


    /**
     *  ID
     **/
    var id: Int? = null

    /**
     *  输入键码
     **/
    var code: String? = null

    /**
     *  班次名1
     **/
    var name1: String? = null

    /**
     *  班次名2
     **/
    var name2: String? = null

    /**
     *  开始时间
     **/
    var start_time: String? = null

    /**
     *  结束时间
     **/
    var end_time: String? = null

    /**
     *  背景颜色
     **/
    var bg_color: String? = null

    /**
     *  字体颜色
     **/
    var font_color: String? = null

    /**
     *  备注
     **/
    var remark: String? = null

    /**
     *  更新人
     **/
    var update_by: Int? = null

    /**
     *  更新时间
     **/
    var update_time: LocalDateTime? = null


    fun getShiftTypeVo(table: ShiftTypeVo?): ShiftTypeVo? {
        table?.let {
            val data = ShiftTypeVo()
            data.id = it.id
            data.code = it.code
            data.name1 = it.name1
            data.name2 = it.name2
            data.start_time = it.start_time
            data.end_time = it.end_time
            data.bg_color = it.bg_color
            data.font_color = it.font_color
            data.remark = it.remark
            data.update_by = it.update_by
            data.update_time = it.update_time
            return data
        }
        return null
    }


    fun getShiftTypeVoList(table:List<TShiftType>?):List<ShiftTypeVo> ? {
        table?.let {
            val shiftTypeVoList = mutableListOf<ShiftTypeVo>()
            table.forEach {
                val data = ShiftTypeVo()
                data.id = it.id
                data.code = it.code
                data.name1 = it.name1
                data.name2 = it.name2
                data.start_time = it.start_time
                data.end_time = it.end_time
                data.bg_color = it.bg_color
                data.font_color = it.font_color
                data.remark = it.remark
                data.update_by = it.update_by
                data.update_time = it.update_time
                shiftTypeVoList.add(data)
            }
            return shiftTypeVoList
        }
        return null
    }

}